//
//  VcTransitionsTableViewController.m
//  TestPrj
//
//  Created by 朱铅峰 on 2019/12/19.
//  Copyright © 2019 Xing. All rights reserved.
//

#import "VcTransitionsTableViewController.h"
#import "ASTodayTransFromViewController.h"

@interface VcTransitionsTableViewController ()

proStrong NSArray *dataSource;

@end

@implementation VcTransitionsTableViewController

- (void)viewDidLoad {
    
    [super viewDidLoad];
    
    self.title = @"VC转场";
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemStop target:self action:@selector(dismissAction)];
    
    self.dataSource = @[@"模仿Appstore中Today转场动画实现"];
    
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:@"cell"];
}

- (void)dismissAction {
    
    [self.navigationController dismissViewControllerAnimated:YES completion:nil];
}

#pragma mark - Table view data source

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView {
#warning Incomplete implementation, return the number of sections
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
#warning Incomplete implementation, return the number of rows
    return _dataSource.count;
}


- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell" forIndexPath:indexPath];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    cell.textLabel.numberOfLines = 0;
    cell.textLabel.text = self.dataSource[indexPath.row];
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
    
    if (indexPath.row == 0) {
        
        ASTodayTransFromViewController *vc = [[ASTodayTransFromViewController alloc] init];
        [self.navigationController pushViewController:vc animated:YES];
    }
}

@end
